package 算法;

import java.util.HashMap;

/**
 * @author coderFu
 * @create 2022/3/14
 */
public class Demo {

    public static void main(String[] args) {
        int count = findMaximizedCapital(2,0,new int[]{1,2,3},new int[]{0,1,1});
        System.out.println(count);
    }


    public static int findMaximizedCapital(int k, int w, int[] profits, int[] capital){
        int sum = w;
        HashMap<Integer, Integer> map = new HashMap<>();
        String  s = "aa";
        int length = s.length();
        System.out.println(length);
        for(int i=0; i<profits.length; i++){
            if (map.get(capital[i]) == null){
                map.put(capital[i],profits[i]);
            }else {
                // update the max value
                Integer count = map.get(capital[i]);
                if (count < profits[i]){
                    map.put(capital[i], profits[i]);
                }
            }
        }

        for (int i=1; i<=k; i++){

            Integer price = map.get(sum);
            sum = sum + price;
        }



        return sum;
    }
}
